import { WhiteList } from '@/setting'

const originFind = Room.prototype.find
Room.prototype.find = function (type: any, opts: any) {
    let result = originFind.call(this, type, opts)
    if (
        type === FIND_HOSTILE_CREEPS ||
        type === FIND_HOSTILE_CONSTRUCTION_SITES ||
        type === FIND_HOSTILE_POWER_CREEPS ||
        type === FIND_HOSTILE_SPAWNS ||
        type === FIND_HOSTILE_STRUCTURES
    ) {
        // @ts-ignore
        result = _.filter(result, (o) => !WhiteList.has(o.owner.username))
    }
    return result
}
